package xyz.xtt.asset.constants;

import java.util.Arrays;
import java.util.Objects;

/**
 * 业务线类型
 * 
 * @author huqibo
 * @date 2025/01/21
 */
public enum AssetCardDestoryStatenum {
	/**
	 * 正常
	 */
	NORMAL(0, "正常"),
	/**
	 * 作废
	 */
	DRSTORY(1, "作废"),;

	/**
	 * 编码
	 */
	private int code;
	/**
	 * 描述
	 */
	private String desc;

	AssetCardDestoryStatenum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public int code() {
		return code;
	}

	public String desc() {
		return desc;
	}

	public static boolean checkType(String checkType) {
		return Arrays.asList(AssetCardDestoryStatenum.values()).stream().anyMatch(x -> Objects.equals(x.name(), checkType));
	}

	public static AssetCardDestoryStatenum convert(String checkType) {
		return Arrays.asList(AssetCardDestoryStatenum.values()).stream().filter(x -> Objects.equals(x.name(), checkType)).findFirst().orElse(null);
	}

	public static AssetCardDestoryStatenum getByCode(int code) {
		return Arrays.asList(AssetCardDestoryStatenum.values()).stream().filter(x -> Objects.equals(x.code(), code)).findFirst().orElse(null);
	}

}
